# coding: utf-8
from . import db, BaseModel


class SsoUser(BaseModel):
    __tablename__ = 'sso_user'

    auto_id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.String(20, 'utf8mb4_0900_ai_ci'), nullable=False, index=True, info='用户ID')
    role_id = db.Column(db.String(20, 'utf8mb4_0900_ai_ci'), info='角色id')
    account = db.Column(db.String(255, 'utf8mb4_0900_ai_ci'), nullable=False, info='账号名')
    password = db.Column(db.String(500, 'utf8mb4_0900_ai_ci'), nullable=False, info='密码')
    user_name = db.Column(db.String(500, 'utf8mb4_0900_ai_ci'), info='昵称')
    email = db.Column(db.String(255, 'utf8mb4_0900_ai_ci'), info='邮箱')
    phone = db.Column(db.String(255, 'utf8mb4_0900_ai_ci'), info='手机号')
    valid_type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='账号认证类型 0.未认证 \\r\\n1.邮箱 \\r\\n2.手机号 3.双重认证 ')
    user_type = db.Column(db.Integer, server_default=db.FetchedValue(), info='用户类型：\\r\\n0- 普通用户 1- 管理员 2- 超级管理员')
    open_id = db.Column(db.String(50, 'utf8mb4_0900_ai_ci'), info='微信登录的open_id')
    head_pic = db.Column(db.String(255, 'utf8mb4_0900_ai_ci'), info='头像url')
    key_id = db.Column(db.String(20, 'utf8mb4_0900_ai_ci'), info='API KEY ID')
    status = db.Column(db.Integer, server_default=db.FetchedValue(), info='账号状态 0- 有效 1-冻结')
    is_deleted = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否删除')
    create_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='创建记录时间')
    update_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='更新记录时间')
